export default function registerJavaClassTask(lf) {
    // javaClassTask节点
    lf.register('javaClassTask', ({ RectNode, RectNodeModel, h }) => {
        class View extends RectNode {
            getShape() {
                const { model } = this.props
                const { width, height, x, y, } = model
                const position = {
                    x: x - width / 2,
                    y: y - height / 2,
                    width,
                    height,
                }
                const style = model.getNodeStyle()
                    // const style1 = this.getAttributes()
                    // console.log(style1,'style1')


                if (style.debug) {
                    return h("g", {}, [
                        h("rect", {
                            ...style,
                            ...position,
                        }),
                        h(
                            'svg', {
                                x: x - width / 2 + 44,
                                y: y - height / 2 + 5,
                                width: 15,
                                height: 15,
                                viewBox: "0 0 1274 1024",
                            },
                            h(
                                'path', {
                                    fill: 'red',
                                    d: 'M817.152 202.752 817.152 202.752C737.28 122.88 628.736 75.776 509.952 75.776c-118.784 0-229.376 49.152-307.2 126.976l0 0c-77.824 77.824-126.976 186.368-126.976 307.2 0 118.784 49.152 229.376 126.976 307.2 77.824 79.872 188.416 126.976 307.2 126.976 120.832 0 229.376-49.152 307.2-126.976 79.872-77.824 126.976-186.368 126.976-307.2C946.176 389.12 897.024 280.576 817.152 202.752zM770.048 770.048c-65.536 65.536-157.696 108.544-260.096 108.544-102.4 0-194.56-40.96-260.096-108.544C184.32 704.512 141.312 612.352 141.312 509.952s40.96-194.56 108.544-260.096C317.44 184.32 409.6 141.312 509.952 141.312c100.352 0 192.512 40.96 258.048 106.496l2.048 2.048c65.536 65.536 108.544 157.696 108.544 260.096S837.632 704.512 770.048 770.048z'
                                }
                            )
                        )

                    ]);
                } else {
                    return h("rect", {
                        ...style,
                        ...position,
                    });
                }

            }
        }

        class Model extends RectNodeModel {
            constructor(data, graphModel) {
                super(data, graphModel)
                this.radius = 4;
            }

            // 审批过后变绿
            setAttributes() {

            }

            initNodeData(data) {
                data.text = {
                    value: (data.text && data.text.value) || 'Java执行节点',
                    x: data.x,
                    y: data.y,
                    dragable: false,
                    editable: true
                }
                super.initNodeData(data)
            }

            getNodeStyle() {
                const style = super.getNodeStyle()
                const {
                    properties: {
                        isStayed
                        // ,debug
                        ,
                        isPassed,
                        deBug
                    }
                } = this;
                console.log(isStayed, 'isStayed', isPassed, 'isPassed', deBug, 'storageBreakpoints')
                    // 断点黄色
                if (isStayed) {
                    style.strokeWidth = '2'
                    style.stroke = '#DAA520'
                }
                // 打断点出现的样式
                if (deBug) {
                    style.debug = true
                }
                // 走过绿色
                if (isPassed) {
                    style.strokeWidth = '2'
                    style.stroke = 'green'
                }
                // if(isSelected){
                //     style.strokeWidth = 'green'
                // }
                return style
            }

        }


        return {
            view: View,
            model: Model
        }
    })
}